home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 001a / com_and4.zip / TALKER.CMD < prev    next >
OS/2 REXX Batch file  |  1990-03-12  |  10KB  |  346 lines

  1.    S29 = "Talker  ver 1.0     " ; 20 chars long
  2.    LEGEND S29
  3.    S28 = "talker.ovl"           ; Our overlay file
  4.    S27 = "pc-vco.exc"           ; Our exception file
  5. ;
  6. ; ----- Talker: Scripted interface to VOICE.EXE
  7. ;
  8. ;    R.McG; 3/90, Chicago
  9. ; ----------------------------------------------------------------
  10. ; Usages:
  11. ;      S29 -----> Legend line
  12. ;      S28 -----> Our own overlay file name
  13. ;      S27 -----> Our exception file
  14. ;      S26 -----> Previous overlay file name (or null)
  15. ;
  16. ;      N99 -----> Number of lines on screen
  17. ;
  18. ; -----------------------------------------------------------------------
  19. ;
  20. ;    Initialization
  21. ;
  22. ;    Initial values
  23. ;
  24.    S26 = "_OVERLAY"                     ; Save previous overlay, if any
  25.    ON ESCAPE GOSUB Esc_Exit        ; ESC exit
  26. ;
  27. ;    Set-up the overlay (our interface to VOICE.EXE).
  28. ;
  29.    OVERLAY S28                ; Load our overlay
  30.    IF FAILED                ; Stop here if can't load overlay
  31.       MESS "!Cannot overlay file: "*S28*"!"
  32.       GOTO Exit
  33.       ENDIF
  34. ;
  35. ;    Use the overlay to 'open' the driver
  36. ;
  37.    SCALL 6,N0                ; Entry addr 6 -> open_talk
  38.    IF NOT ZERO N0            ; If anything but zero rtnd
  39.       MESS "!Cannot open voice driver!"
  40.       IF NOT ISFILE "voice.exe" MESS "!VOICE.EXE must be on current subdir!"
  41.       GOTO Exit
  42.       ENDIF
  43. ;
  44. ;    Load an exception file, if its present
  45. ;
  46.    SCALL 12,S27,N0            ; Entry addr 12 -> Load exception file
  47.    IF NOT ZERO N0            ; If anything but zero rtnd
  48.       MESS "!Exception file load error: "*N0*" using: "*S27*"!"
  49.       ENDIF                ; Not fatal error
  50.    GOTO Loop                ; And start
  51. ;
  52. ;    Script termination
  53. ;
  54. Exit:
  55.    IF OVERLAY SCALL 9            ; Entry addr 9 -> Close voice driver
  56.    OVERLAY CLEAR            ; Clear our own
  57.    IF NOT NULL S26 OVERLAY S26        ; If there was a previous, replace it
  58.    EXIT
  59. ;
  60. ;    Escape pressed
  61. ;
  62. Esc_Exit:
  63.    S0 = "Do you wish to terminate TALKER?"
  64.    GOSUB Ask_YN             ; Prompt
  65.    IF FAILED Return            ; "N" -> continue
  66.    GOTO Exit                ; Terminate
  67. ;
  68. ;    Wait for something
  69. ;
  70. Loop:
  71.    WHILE FKEY or NOT RECEIVE        ; While nothing being received
  72.      IF FKEY GOTO Fkey        ; Skip if a func key pending
  73.      ENDWHILE            ; .. loop to make kbd fast
  74.    RGET S0 80 3             ; Get 80 chars - wait up to 3 secs
  75.    IF FAILED GOTO Loop            ; IF nothing received, Loop
  76.    SCALL 0,S0                ; Pass buffer to the driver
  77.    IF NOT FULL GOTO Loop        ; If not full rcv buffer
  78. ;
  79. ;    Flush the rcv buffer
  80. ;
  81.    LEGEND S29*"Flushing buffer"         ; Change legend
  82.    WHILE FULL                ; While buffer full (host xoffed)
  83.      RGET S0 80 30            ; Read a line and display, no voice
  84.      ENDWHILE            ;
  85.    LEGEND S29                ; Replace legend
  86.    GOTO Loop                ; And loop
  87. ;
  88. ;    Function key pending
  89. ;
  90. Fkey:
  91.    KEYGET S0                ; Read the function key
  92.    SWITCH S0
  93.       CASE "2E00"                       ; Alt-C
  94.      CLEAR (text)            ; Perform
  95.      LEGEND S29            ; Repaint legend
  96.       ENDCASE
  97.       CASE "1200"                       ; Alt-E
  98.      GOTO Echo
  99.       ENDCASE
  100.       CASE "2C00"                       ; Alt-Z
  101.      GOTO Mask
  102.       ENDCASE
  103.       CASE "2600"                       ; Alt-L
  104.      GOTO ScrSize
  105.       ENDCASE
  106.       CASE "2300"                       ; Alt-H
  107.      HANGUP             ; perform
  108.       ENDCASE
  109.       CASE "2200"                       ; Alt-G
  110.      GOTO Blnkln
  111.       ENDCASE
  112.       CASE "2D00"                       ; Alt-X
  113.      GOTO EndPgm
  114.       ENDCASE
  115.  
  116.       CASE "7500"                       ; Ctl-End
  117.      BREAK                ; Perform
  118.       ENDCASE
  119.       CASE "7200"                       ; Ctl-PrtSc
  120.      GOTO Printer
  121.       ENDCASE
  122.  
  123.       CASE "7800"                       ; Alt-1
  124.      MACRO 1            ; Perform
  125.       ENDCASE
  126.       CASE "7900"                       ; Alt-2
  127.      MACRO 2            ; Perform
  128.       ENDCASE
  129.       CASE "7A00"                       ; Alt-3
  130.      MACRO 3            ; Perform
  131.       ENDCASE
  132.       CASE "7B00"                       ; Alt-4
  133.      MACRO 4            ; Perform
  134.       ENDCASE
  135.       CASE "7C00"                       ; Alt-5
  136.      MACRO 5            ; Perform
  137.       ENDCASE
  138.       CASE "7D00"                       ; Alt-6
  139.      MACRO 6            ; Perform
  140.       ENDCASE
  141.       CASE "7E00"                       ; Alt-7
  142.      MACRO 7            ; Perform
  143.       ENDCASE
  144.       CASE "7F00"                       ; Alt-8
  145.      MACRO 8            ; Perform
  146.       ENDCASE
  147.       CASE "8000"                       ; Alt-9
  148.      MACRO 9            ; Perform
  149.       ENDCASE
  150.       CASE "8100"                       ; Alt-0
  151.      MACRO 0            ; Perform
  152.       ENDCASE
  153.  
  154.       CASE "4100"                       ; F7
  155.      GOTO Log
  156.       ENDCASE
  157.       CASE "4300"                       ; F9
  158.      GOTO LogHold
  159.       ENDCASE
  160.       CASE "4400"                       ; F10
  161.      GOSUB Help            ; Note uncharacteristic GOSUB
  162.       ENDCASE
  163.       CASE "7100"                       ; Alt-F10
  164.      SHELL                ; Shell to DOS
  165.       ENDCASE
  166.       ;
  167.       ; Other keypresses are unrecognized
  168.       ;
  169.       DEFAULT
  170.      SOUND 100,100            ; Signal error
  171.       ENDCASE
  172.    ENDSWITCH
  173.    GOTO Loop                ; And continue
  174. ;
  175. ;    End pgm
  176. ;
  177. EndPgm:
  178.    SET TTHRU ON         ; Inhibit type-through
  179.    STACK "^@-"                  ; Stack another Alt-X
  180.    GOTO Exit            ; End script (and COM-AND)
  181. ;
  182. ;    Toggle echo
  183. ;
  184. Echo:
  185.    IF STRCMP "_DUPL" "HALF"     ; Test current setting
  186.       SET DUPLEX FULL        ; .. toggle
  187.    ELSE SET DUPLEX HALF     ; .. toggle
  188.    GOTO Loop            ; And continue
  189. ;
  190. ;    Toggle mask
  191. ;
  192. Mask:
  193.    IF STRCMP "_MASK" "ON "      ; Test current setting
  194.       SET MASK OFF        ; .. toggle
  195.    ELSE SET MASK ON        ; .. toggle
  196.    GOTO Loop            ; And continue
  197. ;
  198. ;    Toggle screen size
  199. ;
  200. ScrSize:
  201.    IF GT "_SSIZ" 25
  202.       SET 25            ; .. toggle
  203.    ELSE SET 43            ; .. toggle
  204.    LEGEND S29            ; Repaint legend
  205.    GOTO Loop            ; And continue
  206. ;
  207. ;    Toggle printer
  208. ;
  209. Printer:
  210.    IF STRCMP "_PRINT" "ON "     ; Test state
  211.       PRINTER OFF        ; .. toggle
  212.    ELSE PRINTER ON
  213.    GOTO Loop            ; And continue
  214. ;
  215. ;    Toggle the blank line eater
  216. ;
  217. Blnkln:
  218.    IF STRCMP "_BSUP" "ON "      ; Test current setting
  219.       SET BSUPPRESS OFF     ; .. toggle
  220.    ELSE SET BSUPPRESS ON    ; .. toggle
  221.    GOTO Loop            ; And continue
  222. ;
  223. ;    Toggle the log function
  224. ;
  225. Log:
  226.    IF STRCMP "_LOGG" "OFF"
  227.       S1 = "Enter the transcript file name:"
  228.       GOSUB Ask_File        ; Get script file name
  229.       IF NOT SUCCESS or NULL S0 ; IF ESC'd out
  230.      GOTO Loop
  231.      ENDIF
  232.       LOG OPEN S0
  233.    ELSE
  234.       LOG CLOSE
  235.       ENDIF
  236.    GOTO Loop            ; Set-up the line to add to output
  237. ;
  238. ;    Toggle the log hold function
  239. ;
  240. LogHold:
  241.    IF STRCMP "_LOGG" "OFF"      ; If not logging
  242.       GOTO Loop
  243.       ENDIF
  244.    IF STRCMP "_LOGH" "OFF"
  245.       LOG SUSPEND
  246.    ELSE LOG RESUME
  247.    GOTO Loop            ; Set-up the line to add to output
  248. ;
  249. ; ----- Subroutine: Ask for a script file name
  250. ;    S1 passes the prompt used
  251. ;    SUCCESS returns fact script file successfully opened
  252. ;    S0 returns the fname
  253. ;
  254. Ask_File:
  255.    WOPEN 10 10 13 70 (contrast) ASK_ESC
  256.    ATSAY 10 12 (contrast) " TALKER Fname "
  257.    ATSAY 11 12 (contrast) S1(0:56)
  258.    ATSAY 13 30 (contrast) " Press ESC to cancel "
  259.  
  260.    ATGET 12 12 (contrast) 54 S0; Read new fname
  261.    WCLOSE
  262.    ;
  263.    ;       Attempt to execute the entry
  264.    ;
  265.    LJ S0            ; Left justify
  266.    S0 = S0 &""                  ; Trim spaces
  267.    UPPER S0            ; Make pretty
  268.    IF NOT NULL S0        ; If nothing entered
  269.       SET SUCCESS ON
  270.    ELSE
  271.       SET SUCCESS OFF
  272.       ENDIF
  273.    RETURN            ; And done
  274. ;
  275. ; ----- Escape during a subwindow
  276. ;    .. S0 is returned null
  277. ;
  278. Ask_Esc:
  279.    S0 = ""                      ; Make a null return
  280.    RETURN
  281. ;
  282. ; ----- Subroutine: Ask a question and take a y/n answer
  283. ;    S0 passes the text to be displayed
  284. ;    SUCCESS returns fact of y/n
  285. ;
  286. Ask_YN:
  287.    WOPEN 10 10 13 70 (contrast) ASK_ESC
  288.    ATSAY 10 12 (contrast) " Talker Y/N "
  289.    ATSAY 11 12 (contrast) S0(0:55)
  290.    ATSAY 13 30 (contrast) " Press ESC to cancel "
  291.  
  292.    ATGET 12 12 (contrast) 1 S0 ; Read y/n
  293.    WCLOSE
  294.    ;
  295.    ;       Interperet the response
  296.    ;
  297.    IF NULL S0 or FIND S0 "Y"    ; If c/r yes
  298.       SET SUCCESS ON
  299.    ELSE
  300.       SET SUCCESS OFF
  301.       ENDIF
  302.    RETURN            ; And done
  303. ;
  304. ; ----- Subroutine: Help
  305. ;
  306. Help:
  307.    WOPEN  0, 0,23,79 (default) HELPESC
  308.    ATSAY  0, 2 (Default) " Talker Help "
  309.    ATSAY 23,28 (Default) " Press any key to continue "
  310. ;
  311. ;    Help message
  312. ;
  313.    ATSAY  1,2 (default) "   The TALKER script expects to find the voice driver (VOICE.EXE) already"
  314.    ATSAY  2,2 (default) "loaded.  If it does not find the voice driver loaded, this script will try"
  315.    ATSAY  3,2 (default) "to load VOICE.EXE from the current subdirectory.  If the driver does not"
  316.    ATSAY  4,2 (default) "load, it may be for one of two reasons - (1) insufficient memory to load"
  317.    ATSAY  5,2 (default) "the driver, or (2) VOICE.EXE not found on the current subdirectory."
  318.    ATSAY  6,2 (default) ""
  319.    ATSAY  7,2 (default) "   The TALKER script itself loads the file TALKER.EXE.  This file is NOT a"
  320.    ATSAY  8,2 (default) "program that runs by itself... it is a set of machine language subroutines"
  321.    ATSAY  9,2 (default) "to the TALKER.CMD script.  These routines provide the interface to the voice"
  322.    ATSAY 10,2 (default) "driver.  The script calls routines in TALKER to speak."
  323.    ATSAY 11,2 (default) ""
  324.    ATSAY 12,2 (default) "   If the TALKER script loads VOICE.EXE, it will terminate VOICE.EXE when"
  325.    ATSAY 13,2 (default) "the script terminates.  If TALKER does NOT load VOICE.EXE (already running)"
  326.    ATSAY 14,2 (default) "you may terminate VOICE.EXE with the VEND.COM utility."
  327.    ATSAY 15,2 (default) ""
  328.    ATSAY 16,2 (default) "   While TALKER is running, type-through is available, and certain function"
  329.    ATSAY 17,2 (default) "keys are activated:  These are:"
  330.    ATSAY 18,2 (default) ""
  331.    ATSAY 19,2 (default) "Alt-C (clear)     Alt-H (hangup)        Alt-0/9 (macro)    Ctl-Prtsc (print)"
  332.    ATSAY 20,2 (default) "Alt-E (echo)      Alt-X (exit COM-AND)                     Ctl-End (break)"
  333.    ATSAY 21,2 (default) "Alt-L (scr size)  Alt-Z (mask)          F7 (transcript)  "
  334.    ATSAY 22,2 (default) "Alt-G (blnkln)    Alt-F10 (shell)       F9 (hold transc) "
  335. ;
  336. ;    Wait for a keypress, and return
  337. ;
  338.    KEYGET S0
  339.    WCLOSE
  340.    RETURN
  341.    ;
  342.    ;    ESCAPE during this screen
  343.    ;
  344. HELPESC:
  345.    RETURN
  346.